| Day | Hours | Topic |
|---|---|---|
| Monday | 09.00-11.30 | Introduction to R and RStudio (A) |
| 13.30-16.30 | How is R organized? (B) | |
| Tuesday | 08.30-11.30 | Data manipulation (C) |
| 13.30-16.30 | Analyzing data (D) | |
| Wednesday | 08.30-11.30 | Data visualization (E) |
| 13.30-16.30 | Loops and functions (F) | |
| Thursday | 08.30-11.30 | Linear regression and R Markdown (G) |
| 13.30-16.30 | Outstanding issues, Q and A |
https://mmollerup.github.io/RVietnam/library(tidyverse)This is why we use R-Studio.
.Rproj file. When you open the project file, you start a new session, with your working directory in the project folder
R looks for files you want to load and puts files you want to save.
getwd(), and you can set it with setwd() - but you should not do it, because it results in more fragile code.## Good!: saveRDS( MyObject, "/Output/MyObject.RDS") ## No!: saveRDS( MitObject, "C:/Documents/This Project/Output/MyObject.RDS")
(Also note: R uses / and not \ in paths to files)
Everything that is published on the Comprehensive R Archive Network (CRAN) and is aimed at R users, must be accompanied by a help file.
If you know the name of the function that performs an operation, e.g. anova(), then you just type ?anova or help(anova) in the console.
If you do not know the name of the function: type ?? followed by your search criterion. For example ??anova returns a list of all help pages that contain the word ‘anova’
Alternatively, the internet will tell you almost everything you’d like to know (and then some)
Sites such as http://www.stackoverflow.com and http://www.stackexchange.com, as well as Google can be of tremendous help.
R related issues; use ‘R:’ as a prefix in your search termR works with objects that consist of elements. The smallest elements are numbers and characters.
Assigning things in R is very straightforward:
<-For example, if you assign the value 100 (an element) to object a, you would type
a <- 100
Calling things in R is also very straightforward:
For example, we assigned the value 100 to object a. To call object a, we would type
a
## [1] 100